Optimal. Leaf size=137 \[ a^3 B x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b \left (9 a b B+8 a^2 C+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {b^2 (3 b B+5 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 137, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {4157, 4003,
4133, 3855, 3852, 8} \begin {gather*} a^3 B x+\frac {b \left (8 a^2 C+9 a b B+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {\left (2 a^3 C+6 a^2 b B+3 a b^2 C+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (5 a C+3 b B) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {b C \tan (c+d x) (a+b \sec (c+d x))^2}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4003
Rule 4133
Rule 4157
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \sec (c+d x))^3 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\int (a+b \sec (c+d x))^3 (B+C \sec (c+d x)) \, dx\\ &=\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \sec (c+d x)) \left (3 a^2 B+\left (6 a b B+3 a^2 C+2 b^2 C\right ) \sec (c+d x)+b (3 b B+5 a C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {b^2 (3 b B+5 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{6} \int \left (6 a^3 B+3 \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \sec (c+d x)+2 b \left (9 a b B+8 a^2 C+2 b^2 C\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^3 B x+\frac {b^2 (3 b B+5 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \left (b \left (9 a b B+8 a^2 C+2 b^2 C\right )\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \int \sec (c+d x) \, dx\\ &=a^3 B x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (3 b B+5 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (b \left (9 a b B+8 a^2 C+2 b^2 C\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^3 B x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b \left (9 a b B+8 a^2 C+2 b^2 C\right ) \tan (c+d x)}{3 d}+\frac {b^2 (3 b B+5 a C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac {b C (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.64, size = 108, normalized size = 0.79 \begin {gather*} \frac {6 a^3 B d x+3 \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 C\right ) \tanh ^{-1}(\sin (c+d x))+3 b \left (6 a b B+6 a^2 C+2 b^2 C+b (b B+3 a C) \sec (c+d x)\right ) \tan (c+d x)+2 b^3 C \tan ^3(c+d x)}{6 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 180, normalized size = 1.31
method | result | size |
derivativedivides | \(\frac {b^{3} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-C \,b^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+3 a \,b^{2} B \tan \left (d x +c \right )+3 C \,b^{2} a \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a^{2} b B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 a^{2} b C \tan \left (d x +c \right )+a^{3} B \left (d x +c \right )+a^{3} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(180\) |
default | \(\frac {b^{3} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-C \,b^{3} \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+3 a \,b^{2} B \tan \left (d x +c \right )+3 C \,b^{2} a \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+3 a^{2} b B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+3 a^{2} b C \tan \left (d x +c \right )+a^{3} B \left (d x +c \right )+a^{3} C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) | \(180\) |
risch | \(a^{3} B x -\frac {i b \left (3 B \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+9 C a b \,{\mathrm e}^{5 i \left (d x +c \right )}-18 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}-18 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-36 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}-36 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 B \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-9 C b a \,{\mathrm e}^{i \left (d x +c \right )}-18 a b B -18 a^{2} C -4 b^{2} C \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} b B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{3} B}{2 d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}-\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} C}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} b B}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{3} B}{2 d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}+\frac {3 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} C}{2 d}\) | \(356\) |
norman | \(\frac {a^{3} B x +a^{3} B x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {b \left (6 a b B +b^{2} B +6 a^{2} C +3 a b C +2 b^{2} C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-3 a^{3} B x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 a^{3} B x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 a^{3} B x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-3 a^{3} B x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {4 b \left (9 a b B +9 a^{2} C +b^{2} C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}+\frac {4 b \left (9 a b B +9 a^{2} C +b^{2} C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {b \left (6 a b B -b^{2} B +6 a^{2} C -3 a b C +2 b^{2} C \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 b^{2} \left (b B +3 a C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{4}}-\frac {\left (6 a^{2} b B +b^{3} B +2 a^{3} C +3 C \,b^{2} a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (6 a^{2} b B +b^{3} B +2 a^{3} C +3 C \,b^{2} a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(398\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 216, normalized size = 1.58 \begin {gather*} \frac {12 \, {\left (d x + c\right )} B a^{3} + 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C b^{3} - 9 \, C a b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 3 \, B b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, C a^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 18 \, B a^{2} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 36 \, C a^{2} b \tan \left (d x + c\right ) + 36 \, B a b^{2} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.21, size = 189, normalized size = 1.38 \begin {gather*} \frac {12 \, B a^{3} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, C b^{3} + 2 \, {\left (9 \, C a^{2} b + 9 \, B a b^{2} + 2 \, C b^{3}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (B + C \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{3} \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 336 vs.
\(2 (129) = 258\).
time = 0.52, size = 336, normalized size = 2.45 \begin {gather*} \frac {6 \, {\left (d x + c\right )} B a^{3} + 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, C a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, C a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (18 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 36 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.58, size = 526, normalized size = 3.84 \begin {gather*} \frac {\frac {B\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {C\,b^3\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {C\,b^3\,\sin \left (c+d\,x\right )}{2}+\frac {3\,B\,a\,b^2\,\sin \left (c+d\,x\right )}{4}+\frac {3\,C\,a^2\,b\,\sin \left (c+d\,x\right )}{4}+\frac {3\,B\,a^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {B\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}-\frac {C\,a^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{2}+\frac {3\,B\,a\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {3\,C\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {3\,C\,a^2\,b\,\sin \left (3\,c+3\,d\,x\right )}{4}+\frac {B\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {B\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}-\frac {C\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{2}-\frac {B\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{2}-\frac {C\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}}{4}-\frac {B\,a^2\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{2}-\frac {C\,a\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}}{4}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________